#include <iostream>
#include "StaticArray.h"
#include "DynamicArray.h"

using namespace DTLib;
using namespace std;

void StaticArrayDemo()
{
    StaticArray<int, 5> s1;

    for (int i = 0; i < s1.length(); i++)
    {
        s1[i] = i * i;
    }

    for (int i = 0; i < s1.length(); i++)
    {
        cout << s1[i] << endl;
    }

    StaticArray<int, 5> s2 = s1;
    for (int i = 0; i < s2.length(); i++)
    {
        cout << s2[i] << endl;
    }

    StaticArray<int, 5> s3;

    s3 = s1;
    for (int i = 0; i < s3.length(); i++)
    {
        cout << s3[i] << endl;
    }

    s3[6] = 100;
}

void DynamicArrayDemo()
{
    DynamicArray<int> s1(5);

    for (int i = 0; i < s1.length(); i++)
    {
        s1[i] = i * i;
    }

    for (int i = 0; i < s1.length(); i++)
    {
        cout << s1[i] << endl;
    }

    DynamicArray<int> s2(10);

    s2 = s1;
    for (int i = 0; i < s2.length(); i++)
    {
        cout << s2[i] << endl;
    }

    s2.resize(3);
    for (int i = 0; i < s2.length(); i++)
    {
        cout << s2[i] << endl;
    }

    s2[4] = 100;
}


int main()
{
    // StaticArrayDemo();
    DynamicArrayDemo();

    return 0;
}
